
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[spVehicle_InsertVehicle]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[spVehicle_InsertVehicle]
GO

GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Eric Liew
-- Create date: 6/2/2009
-- Description:	Insert a Vehicle
-- =============================================
CREATE PROCEDURE [dbo].[spVehicle_InsertVehicle]
{
	@VehicleId Int32(4),
	@EngineNo AnsiString(40),
	@ManufactureDate DateTime(8),
	@CarExpiryDate DateTime(8),
	@RegistrationDueDate DateTime(8),
	@InspectionDate DateTime(8),
	@PurchasePrice AnsiString(50),
	@OwnerId Int32(4),
	@PurchaseDate DateTime(8),
	@Rego AnsiString(10),
	@BodyType Int32(4),
	@Model AnsiString(20),

}
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	INSERT Vehicle
	(
		VehicleId,
		EngineNo,
		ManufactureDate,
		CarExpiryDate,
		RegistrationDueDate,
		InspectionDate,
		PurchasePrice,
		OwnerId,
		PurchaseDate,
		Rego,
		BodyType,
		Model,
	)
	VALUES
	(
		@VehicleId,
		@EngineNo,
		@ManufactureDate,
		@CarExpiryDate,
		@RegistrationDueDate,
		@InspectionDate,
		@PurchasePrice,
		@OwnerId,
		@PurchaseDate,
		@Rego,
		@BodyType,
		@Model,
	) 	

	SELECT @@IDENTITY 
	

 

END
GO
